package eventplanner.validation;

import javax.validation.ConstraintValidator;
import javax.validation.ConstraintValidatorContext;
import java.util.UUID;

public class ValidTokenValidator implements ConstraintValidator<ValidToken, String> {
	@Override
	public void initialize(ValidToken constraintAnnotation) {

	}

	@Override
	public boolean isValid(String value, ConstraintValidatorContext context) {
		try {
			UUID.fromString(value);
			return true;
		} catch (Exception e) {
			return false;
		}
	}
}
